package ac.github.os.api.common

import org.bukkit.Bukkit
import taboolib.common.platform.function.info

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class DepPlugin(val pluginName: String)


fun Any.isDepPlugin(): Boolean {
    val clazz = this::class.java
    if (clazz.isAnnotationPresent(DepPlugin::class.java)) {
        val annotation = clazz.getAnnotation(DepPlugin::class.java)
        return Bukkit.getPluginManager().isPluginEnabled(annotation.pluginName).apply { info("$clazz $this") }
    }
    return true
}